package com.itmema.plugin;

import com.intellij.openapi.ui.DialogWrapper;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;

/**
 * Package: com.itmema.plugin
 * Description：
 * Author: huangjian
 * Date:  2020/10/18 13:13
 * Modified By:
 *
 * @author huangjian
 */
public class TauntDialog extends DialogWrapper {
    private JLabel jLabel;

    protected TauntDialog() {
        super(true);
        setTitle("每天一碗毒鸡汤");
        init();
    }

    @Nullable
    @Override
    protected JComponent createCenterPanel() {
        JPanel jPanel = new JPanel();
        jLabel = new JLabel(ContextUtils.getContext());
        jPanel.add(jLabel);
        return jPanel;
    }

    @Override
    protected JComponent createSouthPanel() {
        JPanel jPanel = new JPanel();
        JButton jButton = new JButton("再干一碗");
        jButton.addActionListener(e -> {
            jLabel.setText(ContextUtils.getContext());
        });
        jPanel.add(jButton);
        return jPanel;
    }
}
